/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import Model.Bookticketdetails;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

/**
 *
 * @author Sony
 */
@ManagedBean(name="BookDetails")
@RequestScoped
public class BookticketdetailsController {
    
    BookticketdetailsHelper helper;
    private Bookticketdetails newBookticketdetails;
    DataModel lstBookticketdetails;
    public BookticketdetailsController(){
        helper = new BookticketdetailsHelper();
        newBookticketdetails = new Bookticketdetails();
    }
    
    public DataModel listAllBookdetails(){
        lstBookticketdetails = new ListDataModel(this.helper.listAllBookticketdetails());
        return lstBookticketdetails;
    }
    
    public void addBookticketdetails(){
        this.helper.updateBookticketdetails(newBookticketdetails);
    }
    
    public void deleteBookticketdetails(Bookticketdetails b){
        this.helper.deleteBookticketdetails(b);
    }

    /**
     * @return the newBookticketdetails
     */
    public Bookticketdetails getNewBookticketdetails() {
        return newBookticketdetails;
    }

    /**
     * @param newBookticketdetails the newBookticketdetails to set
     */
    public void setNewBookticketdetails(Bookticketdetails newBookticketdetails) {
        this.newBookticketdetails = newBookticketdetails;
    }
}
